using System.Collections;
using DG.Tweening;
using UnityEngine;

public class EnemyState_XiaoGuaGua_死亡 : EnemyStateBase_XiaoGuaGua
{
	public override void OnEnter()
	{
		_Mono._Is死亡 = true;
		_Mono._Co2D_自身碰撞器.enabled = false;
		_Mono.F_删除血条();
		_Mono.StartCoroutine(Cor_死亡());
		_Mono._C_攻击判断._伤害 = 30f;
	}

	private IEnumerator Cor_死亡()
	{
		_Mono._SR_Model.DOKill();
		_Mono._Ani.Play("受击");
		_Mono._Rb2D.velocity = 3f * new Vector2(_Mono.transform.position.x - _Mono._BeAttack_Pos.x, 0f).normalized;
		_Mono.transform.localScale = new Vector3((_Mono._BeAttack_Pos.x > _Mono.transform.position.x) ? 1 : (-1), 1f, 1f);
		yield return new WaitForSeconds(0.5f);
		_Mono._Rb2D.velocity = Vector2.zero;
		_Mono._Ani.Play("死亡");
		_Mono._SR_Model.DOFade(0f, 1f);
		_Mono._SR_影子.DOFade(0f, 1f);
		yield return new WaitForSeconds(1.5f);
		Object.Destroy(_Mono.gameObject);
	}

	public override void OnExit()
	{
	}

	public override void OnUpdate()
	{
	}
}
